home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0099_Video Addresses.pas < prev    next >
Pascal/Delphi Source File  |  1994-02-09  |  2KB  |  45 lines

  1.  
  2. CONST
  3.   { Constants for bit plane, video page, and memory block sizes: }
  4.   MonoBase      = $B000;     { Segment offset of MDA/Herc video buffer  }
  5.   CGABase       = $B800;     { Segment offset of CGA video buffer       }
  6.   EGAVGABase    = $A000;     { Segment offset of EGA/VGA video buffer   }
  7.  
  8.   { Size of one video page buffer in modes 0..3: }
  9.   TxtVidPageSize   : Array[0..3] of Word = ($800,$800,$1000,$1000);
  10.   { Actual number of bytes used in these buffers }
  11.   TxtVidPageFilled : Array[0..3] of Word = (2000,2000,4000,4000);
  12.  
  13.   CGAMemBankSize    = $2000; { Size of one CGA memory bank in modes 4, 5 and 6}
  14.   CGAMemBankFilled  = 8000;  { Actual number of bytes used in that bank       }
  15.   HercMemBankSize   = $2000; { Size of one Hercules memory bank               }
  16.   HercMemBankFilled = 7830;  { Actual number of bytes used in that bank       }
  17.   VGA256MemBankSize = 64000;
  18.  
  19.   MDAPageSize   = 4000;      { Size of MDA text buffer }
  20.   V400PageSize  = 32000;     { Size video page in V400VM mode }
  21.  
  22.  
  23. FUNCTION GetVidMode: Byte;
  24.   VAR Regs : Registers;
  25.   BEGIN
  26.     Regs.AH := $0F;
  27.     Intr($10,Regs);
  28.     GetVidMode := Regs.AL;
  29.   END; { GetVidMode }
  30.  
  31.  
  32. FUNCTION VidAddress: Pointer;
  33.   VAR VM: Byte;
  34.   BEGIN
  35.     VM := GetVidMode;
  36.     CASE VM OF
  37.       0..3   : VidAddress := Ptr(CGABase,GetVisualPage * TxtVidPageSize[VM]);
  38.       4..6   : VidAddress := Ptr(CGABase,0);
  39.       7      : VidAddress := Ptr(MonoBase,0);  { Also HercVM }
  40.       13..19 : VidAddress := Ptr(EGAVGABase,0);
  41.       V400VM : VidAddress := Ptr(EGAVGABase,GetVisualPage * V400PageSize);
  42.       ELSE     DumBool := CheckError(TRUE,'VIDADDRESS',68);
  43.     END;
  44.   END; { VidAddress }
  45.